apiready = function(){
seajs.use(['../../V',"../../api","../../jquery","../../app","../../service","../../dialog"],function(V,$api,$,app,service,dialog){
	var vm = {
		el: '.container',
	  	data: {
				goodsId: '', // 商品id
				groupId: '', // 拼团id
				groupInfo: {},
				time:{
					default: '00.00.00.0'
				},
				countTime: '00.00.00.0'
			},
	  	created: function () {
				this.goodsId = api.pageParam.goodsId;
				this.groupId = api.pageParam.groupId;
				this.init();
			},
	  	methods:{
				init: function () {
					this.getShopInfo();
				},
				getShopInfo: function () {
					var that = this;
					app.ajax(
						service['groupShare'],
						{
							data: {
								values: {
									goods_id: that.goodsId,
									group_team_id: that.groupId
								}
							}
						},
						function (res) {
							if (res.code == 0) {
								that.groupInfo = res.data;
								that.time = res.data.expire_time;
							}
						}
					);
				},
        intoGroup: function () {
					var customer_id = this.groupInfo.group_id;
					var option_id = this.groupInfo.option_id;
					var str = option_id + ',1,1,' + customer_id;
					app.openWin('buyOrder', {options: str});
        }
      },
			mounted: function () {
				var self = this;
				var countTime = function(){
					var count = 0;

					var timer = setInterval(function(){
						var timeNumber = 9,twoTime = 0;
						var now = (new Date(self.time)) - (new Date());
						var hh = Math.floor(now/(60*60*1000));
						var mm = Math.floor(now%(60*60*1000)/(60*1000));
						var ss = Math.floor(now%(60*60*1000)%(60*1000)/1000);
						clearInterval(_timer);
						if(now <= 0){
							clearInterval(timer);
							return;
						}
						var _timer = setInterval(function(){
							timeNumber--;
							twoTime++;
							self.countTime = (hh >= 10 ? hh : "0"+hh)+":"+(mm >= 10 ? mm : "0"+mm)+":"+(ss >= 10 ? ss : "0"+ss)+"."+timeNumber;
							if(timeNumber <= 0){
								timeNumber = 9;
							}
							if(twoTime == 20){
								clearInterval(_timer);
							}
						},50);
					},1000);
				}
				countTime();
			}
	};

	var even = function() {}
	var newVue = new Vue(vm);
	even();
});
}
